import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/custom_modele/custom_title_content_day_view.dart';
import 'package:enterprise_v6_app/app/components/custom_multi_choice_checkbox/CustomCheckbox.dart';
import 'package:enterprise_v6_app/app/components/custom_multi_choice_checkbox/CustomMultiChoiceCheckbox.dart';
import 'package:enterprise_v6_app/app/components/custom_multi_choice_checkbox/CustomTwoChoiceCheckbox.dart';
import 'package:enterprise_v6_app/app/components/special_operation/custom_high_input_page.dart';
import 'package:enterprise_v6_app/app/components/toast_widget.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/ext.dart';
import 'package:enterprise_v6_app/app/modules/task/task_all/risk_control/daily_approve/daily_approve_controller.dart';

///每日承诺审签
class DailyApprovePage extends StatelessWidget {
  DailyApprovePage({super.key});

  final controller = Get.put(DailyApproveController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.bg_color_grey,
      appBar: CustomAppBar(
        titleText: '每日承诺审签',
      ),
      body: Column(
        children: [
          _titleBg(),
          _topWidget(),
          AppGaps.vGap16,
          Expanded(
            child: Container(
              margin: EdgeInsets.only(bottom: 30.w),
              child: Obx(() {
                switch (controller.currentStep.value) {
                  case 0:
                    return _onePage();
                  case 1:
                    return _twoPage();
                  case 2:
                    return _threePage();
                  case 3:
                    return _fourPage();
                  case 4:
                    return _fivePage();
                  case 5:
                    return _sixPage();
                  case 6:
                    return _sevenPage();
                  default:
                    return const Text('未知步骤');
                }
              }),
            ),
          ),
          Container(
            height: 50.w,
            alignment: Alignment.center,
            padding: EdgeInsets.symmetric(horizontal: 16.w),
            decoration: BoxDecoration(
              color: Colors.white,
              boxShadow: [
                BoxShadow(
                  color: const Color(0xffBCBCC5).withOpacity(0.3), // 阴影颜色
                  offset: const Offset(0, -5), // 阴影的偏移量，向上偏移，即上方阴影
                  blurRadius: 10.0, // 阴影的模糊半径
                  spreadRadius: 2.0, // 阴影的扩散半径
                ),
              ],
            ),
            child: Obx(() => Row(
                  children: [
                    if (controller.currentStep.value != 0)
                      Expanded(
                        flex: 3,
                        child: Container(
                            height: 40.w,
                            alignment: Alignment.center,
                            decoration: BoxDecoration(
                              color: const Color(0xffffffff),
                              borderRadius: BorderRadius.all(
                                Radius.circular(20.w),
                              ),
                              border: Border.all(
                                color: const Color(0xFF5C6DFF),
                                width: 1,
                              ),
                            ),
                            child: Text(
                              '上一页',
                              style: TextStyle(
                                fontSize: 16.sp,
                                color: const Color(0xFF5C6DFF),
                              ),
                            )).clickOnce(
                          controller.goToPreviousStep,
                        ),
                      ),
                    if (controller.currentStep.value != 0) AppGaps.hGap20,
                    Expanded(
                      flex: 5,
                      child: Container(
                          height: 40.w,
                          alignment: Alignment.center,
                          decoration: BoxDecoration(
                              color: const Color(0xff5C6DFF),
                              borderRadius: BorderRadius.all(
                                Radius.circular(20.w),
                              )),
                          child: Text(
                            controller.currentStep.value == 6 ? '提交' : '下一步',
                            style: TextStyle(
                              fontSize: 16.sp,
                              color: const Color(0xffffffff),
                            ),
                          )).clickOnce(
                        controller.goToNextStep,
                      ),
                    )
                  ],
                )),
          )
        ],
      ),
    );
  }

  /// 装置运行情况
  Widget _onePage() {
    return _onePageBuildCard();
  }

  /// 主要部分 卡片
  Widget _onePageBuildCard() {
    return CustomTitleContentDayView(
      title: _richTextNameCustom(),
      content: ListView(
        children: [
          _getTextViewEdit(title: '共有装置:', value: '${controller.data?.deviceCount ?? ''}', unit: '套'),
          AppGaps.vGap10,
          _getTextViewEdit(title: '运行:', value: '${controller.data?.runCount ?? ''}', unit: '套'),
          AppGaps.vGap10,
          _getTextViewEdit(title: '停产:', value: '${controller.data?.stopCount ?? ''}', unit: '套'),
          AppGaps.vGap10,
          _getTextViewEdit(title: '检维修:', value: '${controller.data?.inspectCount ?? ''}', unit: '套'),
          AppGaps.vGap10,
          _getTextView(title: '正在开停车装置数：', value: '${controller.data?.openOrStopCount ?? ''}'),
          AppGaps.vGap10,
          _getTextView(title: '开车装置数：', value: '${controller.data?.openDeviceCount ?? ''}'),
          AppGaps.vGap10,
          _getTextView(title: '停车装置数：', value: '${controller.data?.stopDeviceCount ?? ''}'),
          AppGaps.vGap10,
          _getTextView(title: '试生产装置数：', value: '${controller.data?.produceDeviceCount ?? ''}'),
          AppGaps.vGap10,
        ],
      ),
    );
  }

  Widget _twoPage() {
    return _twoPageBuildCard();
  }

  /// 主要部分 卡片
  Widget _twoPageBuildCard() {
    return CustomTitleContentDayView(
      title: _richTextNameCustom(two: true),
      content: Expanded(
        child: ListView(
          children: [
            _titleName(title: '(1) 长白班人员：'),
            AppGaps.vGap5,
            _getTextViewEdit(title: '应到：', value: '${controller.data?.classShouldPeople ?? ''}', unit: '人'),
            AppGaps.vGap5,
            _getTextViewEdit(title: '实到：', value: '${controller.data?.classRealisticPeople ?? ''}', unit: '人'),
            AppGaps.vGap10,
            _getTextView(title: '生产岗位人员：', value: ''),
            AppGaps.vGap5,
            _getTextViewEdit(title: '白班应到：', value: '${controller.data?.produceShouldPeople ?? ''}', unit: '人'),
            AppGaps.vGap5,
            _getTextViewEdit(title: '实到：', value: '${controller.data?.produceRealisticPeople ?? ''}', unit: '人'),
            AppGaps.vGap5,
            _getTextViewEdit(title: '夜班：', value: '${controller.data?.produceBlackPeople ?? ''}', unit: '人'),
            AppGaps.vGap10,
            _getTextView(title: '重点管的危险化工工艺到岗人员：', value: ''),
            AppGaps.vGap5,
            _getTextViewEdit(title: '硝化工艺：', value: '${controller.data?.nitrificationPeople ?? ''}', unit: '人'),
            AppGaps.vGap5,
            _getTextViewEdit(title: '加氢工艺：', value: '${controller.data?.hydrogenationPeople ?? ''}', unit: '人'),
            AppGaps.vGap10,
            _getTextView(title: '人员精神/身体状态，是否有异常：', value: ''), // peopleBody 人员精神/身体状态 0：异常 1：正常
            AppGaps.vGap10,
            _checkBox(
              choice1Text: '是',
              choice2Text: '否',
              initialChoice1: controller.data?.peopleBody == 1 ? true : false,
              initialChoice2: controller.data?.peopleBody == 0 ? true : false,
            ),
            AppGaps.vGap10,
            _titleName(title: '(2) 特种作业人员是否持证上岗：'), //specialWorkCertificate 特殊作业人员是否持证上岗 0：否 1：是
            AppGaps.vGap10,
            _checkBox(
              choice1Text: '是',
              choice2Text: '否',
              initialChoice1: controller.data?.specialWorkCertificate == 1 ? true : false,
              initialChoice2: controller.data?.specialWorkCertificate == 0 ? true : false,
            ),
            AppGaps.vGap10,
            _titleName(title: '(3) 重大危险源包保责任人：'),
            AppGaps.vGap5,
            _getTextViewEdit(title: '应到：', value: '${controller.data?.guaranteeShouldPeople ?? ''}', unit: '人'),
            AppGaps.vGap5,
            _getTextViewEdit(title: '实到：', value: '${controller.data?.guaranteeRealisticPeople ?? ''}', unit: '人'),
            AppGaps.vGap10,
            _getTextView(title: '包保责任是否落实：', value: ''), //guaranteeStatus 包保责任制是否落实 0：否 1：是
            AppGaps.vGap10,
            // _multiChoiceCheckBox(
            //   choice1Text: '是',
            //   choice2Text: '否',
            //   choice3Text: '不涉及少了一个选项---',
            //   initialChoice1: controller.data?.guaranteeStatus == 1 ? true : false,
            //   initialChoice2: controller.data?.guaranteeStatus == 0 ? true : false,
            //   initialChoice3: controller.data?.guaranteeStatus == 0 ? true : false,
            // ),
            _checkBox(
              choice1Text: '是',
              choice2Text: '否',
              initialChoice1: controller.data?.guaranteeStatus == 1 ? true : false,
              initialChoice2: controller.data?.guaranteeStatus == 0 ? true : false,
            ),
            AppGaps.vGap10,
          ],
        ),
      ),
    );
  }

  Widget _threePage() {
    return _threePageBuildCard();
  }

  /// 主要部分 卡片
  Widget _threePageBuildCard() {
    return CustomTitleContentDayView(
      title: _richTextNameCustom(two: true, three: true),
      content: ListView(
        children: [
          _titleName(title: '(1) 是否涉及高危生产活动及作业：'), // highRiskStatus 0：否 1：是
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.highRiskStatus == 1 ? true : false,
            initialChoice2: controller.data?.highRiskStatus == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _getTextViewEdit(title: '检维修：', value: controller.data?.inspectWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextView(title: '涉及特殊作业：', value: ''),
          AppGaps.vGap5,
          // _getTextView(title: '动火作业：', value: 'XXX处（特级 XX处，一级 XX处，二级 XX处）'),
          _getTextViewEdit(title: '动火作业：', value: controller.data?.oneLevelHotWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '临时用电作业：', value: controller.data?.electricityWork ?? '', unit: '处'),
          AppGaps.vGap5,
          // _getTextView(title: '高处作业：', value: 'XXX处（一级 XX处，二级 XX处，三级 XX处，四级 XX处）'),
          _getTextViewEdit(title: '高处作业：', value: controller.data?.highWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '吊装作业：', value: controller.data?.hoistingWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '受限空间作业：', value: controller.data?.spaceWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '动土作业：', value: controller.data?.soilWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '盲板抽堵作业：', value: controller.data?.plateWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '断路作业：', value: controller.data?.circuitWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '倒灌作业：', value: controller.data?.pourWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '清罐作业：', value: controller.data?.unmixedWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '切水作业：', value: controller.data?.oneLevelHotWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextView(title: '作业内容：', value: ''),
          AppGaps.vGap5,
          _getTextView(title: '地点+作业内容+涉及特殊作业：', value: ''),
          AppGaps.vGap20,
          _getTextViewEdit(title: '外协承包商作业：', value: '${controller.data?.contractStatus ?? '0'}', unit: '处'),
          _getTextView(title: '涉及特殊作业：', value: ''),
          AppGaps.vGap5,
          // _getTextView(title: '动火作业：', value: 'XXX处（特级 XX处，一级 XX处，二级 XX处）'),
          _getTextViewEdit(title: '动火作业：', value: controller.data?.oneLevelHotWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '临时用电作业：', value: controller.data?.electricityWork ?? '', unit: '处'),
          AppGaps.vGap5,
          // _getTextView(title: '高处作业：', value: 'XXX处（一级 XX处，二级 XX处，三级 XX处，四级 XX处）'),
          _getTextViewEdit(title: '高处作业：', value: controller.data?.highWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '吊装作业：', value: controller.data?.hoistingWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '受限空间作业：', value: controller.data?.spaceWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '动土作业：', value: controller.data?.soilWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '盲板抽堵作业：', value: controller.data?.plateWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '断路作业：', value: controller.data?.circuitWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '倒灌作业：', value: controller.data?.pourWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '清罐作业：', value: controller.data?.unmixedWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '切水作业：', value: controller.data?.waterWork ?? '', unit: '处'),
          AppGaps.vGap5,
          _getTextView(title: '作业内容：', value: ''),
          AppGaps.vGap5,
          _getTextView(title: '地点+作业内容+涉及特殊作业：', value: ''),
          AppGaps.vGap20,
          _titleName(title: '(2) 高危生产活动及作业的安全风险管控措施是否落实：'),
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.hignMeasuresStatus == 1 ? true : false,
            initialChoice2: controller.data?.hignMeasuresStatus == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _titleName(title: '(3) 是否存在变更情况：'), //changeStatus 0：否 1：是
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.changeStatus == 1 ? true : false,
            initialChoice2: controller.data?.changeStatus == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _getTextViewEdit(title: '变更作业：', value: '21', unit: '处'),
          AppGaps.vGap10,
          _getTextView(title: '变更是否落实审批程序：', value: ''), // changeProcedureStatus 0：否 1：是
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.changeProcedureStatus == 1 ? true : false,
            initialChoice2: controller.data?.changeProcedureStatus == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _titleName(title: '(4) 是否处于（开/停）车状态：'),
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.isOpenStop == 1 ? true : false,
            initialChoice2: controller.data?.isOpenStop == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _titleName(title: '(5) 是否处于试生产状态：'),
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.production == 1 ? true : false,
            initialChoice2: controller.data?.production == 0 ? true : false,
          ),
        ],
      ),
    );
  }

  Widget _fourPage() {
    return _fourPageBuildCard();
  }

  /// 主要部分 卡片
  Widget _fourPageBuildCard() {
    return CustomTitleContentDayView(
      title: _richTextNameCustom(two: true, three: true, four: true),
      content: ListView(
        children: [
          _titleName(title: '(1) DCS/GDS/SIS系统是否正常：'), //0：否 1：是
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.dcsDeviceStatus == 1 ? true : false,
            initialChoice2: controller.data?.dcsDeviceStatus == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _getTextView(title: '前一日报警处置情况：', value: ''),
          AppGaps.vGap5,
          _getTextViewEdit(title: '1.DCS报警：', value: '${controller.data?.dcsPoliceCount ?? ''}', unit: '条'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '2.GDS：', value: '${controller.data?.gdsPoliceCount ?? ''}', unit: '条'),
          AppGaps.vGap5,
          _getTextViewEdit(title: '3.SIS：', value: '${controller.data?.sisPoliceCount ?? ''}', unit: '条'),
          AppGaps.vGap5,
          _getTextView(title: '如有请说明原因及管控措施：', value: ''),
          AppGaps.vGap5,
          _getTextView(title: ' 报警设备+报警原因+报警处置+处置结果', value: ''),
          AppGaps.vGap10,
          _titleName(title: '(2) 自动化控制是否有效投用：'),
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.controlInto == 1 ? true : false,
            initialChoice2: controller.data?.controlInto == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _titleName(title: '(3) 温度/压力/液位/流量等工艺参数是否处于指标范围：'),
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.processParameters == 1 ? true : false,
            initialChoice2: controller.data?.processParameters == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _titleName(title: '(4) 压力容器、压力管道等特种设备是否安全运行：'),
          AppGaps.vGap5,
          _multiChoiceCheckBox(
            choice1Text: '是',
            choice2Text: '否',
            choice3Text: '不涉及---少一个',
            initialChoice1: controller.data?.specialEquipment == 1 ? true : false,
            initialChoice2: controller.data?.specialEquipment == 0 ? true : false,
            initialChoice3: controller.data?.specialEquipment == 0 ? true : false,
          ),
          AppGaps.vGap5,
          _titleName(title: '(5) 各类设备设施动静密封是否完好无泄漏：'),
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.leakageStatus == 1 ? true : false,
            initialChoice2: controller.data?.leakageStatus == 0 ? true : false,
          ),
          AppGaps.vGap10,
          _titleName(title: '(6) 超限报警、紧急切断、联锁等各类安全设施配备是否完好投用并可靠运行：'),
          AppGaps.vGap10,
          _checkBox(
            choice1Text: '是',
            choice2Text: '否',
            initialChoice1: controller.data?.safetyEquipmentStatus == 1 ? true : false,
            initialChoice2: controller.data?.safetyEquipmentStatus == 0 ? true : false,
          ),
        ],
      ),
    );
  }

  Widget _fivePage() {
    return _fivePageBuildCard();
  }

  /// 主要部分 卡片
  Widget _fivePageBuildCard() {
    return CustomTitleContentDayView(
      title: _richTextNameCustom(two: true, three: true, four: true, five: true),
      content: ListView(
        children: [
          _titleName(title: '是否涉及罐区/仓库/重大危险源：'),
          AppGaps.vGap5,
          _checkBox(choice1Text: '是', choice2Text: '否'),
          AppGaps.vGap10,
          Padding(
            padding: EdgeInsets.only(left: 10.w),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                _titleName(title: '(1) 重大危险源/罐区/仓库是否处于安全状态：'),
                AppGaps.vGap10,
                _checkBox(
                  choice1Text: '是',
                  choice2Text: '否',
                  initialChoice1: controller.data?.hazardSafety == 1 ? true : false,
                  initialChoice2: controller.data?.hazardSafety == 0 ? true : false,
                ),
                AppGaps.vGap10,
                _titleName(title: '(2) 储罐、管道、机泵、阀门及仪表系统是否完好无泄漏：'),
                AppGaps.vGap10,
                _checkBox(
                  choice1Text: '是',
                  choice2Text: '否',
                  initialChoice1: controller.data?.tankGood == 1 ? true : false,
                  initialChoice2: controller.data?.tankGood == 0 ? true : false,
                ),
                AppGaps.vGap10,
                _titleName(title: '(3) 储罐的液位、温度、压力是否超限运行：'),
                AppGaps.vGap10,
                _checkBox(
                  choice1Text: '是',
                  choice2Text: '否',
                  initialChoice1: controller.data?.tankOverdue == 1 ? true : false,
                  initialChoice2: controller.data?.tankOverdue == 0 ? true : false,
                ),
                AppGaps.vGap10,
                _titleName(title: '(4) 重点监管的危险化学品储存量：'),
                AppGaps.vGap10,
                _titleName(title: '氯：      、甲醇：      、甲苯：      、三氯甲烷：     、氢气     、乙炔'),
                AppGaps.vGap10,
                _titleName(title: '(5) 重点监管危险工艺数量：'),
                AppGaps.vGap10,
                _titleName(title: '(6) 有无重大隐患：'),
                AppGaps.vGap10,
                _titleName(title: '(7) 仓库是否按照标准分区分类储存危险化学品：'),
                AppGaps.vGap10,
                _checkBox(
                  choice1Text: '是',
                  choice2Text: '否',
                  initialChoice1: controller.data?.warehouseStatus == 1 ? true : false,
                  initialChoice2: controller.data?.warehouseStatus == 0 ? true : false,
                ),
                AppGaps.vGap10,
                _titleName(title: '(8) 是否超量、超品种储存，相互禁配物是否混放混存：'),
                AppGaps.vGap10,
                _checkBox(
                  choice1Text: '是',
                  choice2Text: '否',
                  initialChoice1: controller.data?.warehouseExcess == 1 ? true : false,
                  initialChoice2: controller.data?.warehouseExcess == 0 ? true : false,
                ),
                AppGaps.vGap10,
                _titleName(title: '(9) 可燃有毒气体报警和联锁是否处于可靠运行：'),
                AppGaps.vGap10,
                _checkBox(
                  choice1Text: '是',
                  choice2Text: '否',
                  initialChoice1: controller.data?.gdsGood == 1 ? true : false,
                  initialChoice2: controller.data?.gdsGood == 0 ? true : false,
                ),
                AppGaps.vGap10,
              ],
            ),
          ),
        ],
      ),
    );
  }

  Widget _sixPage() {
    return _sixPageBuildCard();
  }

  /// 主要部分 卡片
  Widget _sixPageBuildCard() {
    return CustomTitleContentDayView(
      title: _richTextNameCustom(two: true, three: true, four: true, five: true, six: true),
      content: ListView(
        children: [
          CustomHighInputPage(
            title: '安全风险报告',
            hintText: '请输入',
            text: '',
            onCallBack: (value) {
              // controller.insertTbBaseMeasuresTaskRequestEntity.troubleshootContent = value;
            },
            isEnabled: true,
            isShowDivider: false,
          )
        ],
      ),
    );
  }

  Widget _sevenPage() {
    return _sevenPageBuildCard();
  }

  /// 主要部分 卡片
  //       AppGaps.vGap20,
  //         _titleName(
  //           title: '今天我已进行安全风险研判，各项安全风险防控措施已落实到位，我承诺生产装置处于安全运行状态，涉及安全风险得到有效管控。',
  //         ),
  Widget _sevenPageBuildCard() {
    return CustomTitleContentDayView(
      title: _richTextNameCustom(two: true, three: true, four: true, five: true, six: true, seven: true),
      content: Row(
        children: [
          Text(
            '*',
            style: TextStyle(
              fontSize: 14.sp,
              height: 1.2,
              fontWeight: FontWeight.w400,
              color: const Color(0xFFFD6B6B),
            ),
          ),
          Text(
            '承诺人：',
            style: TextStyle(
              fontSize: 14.sp,
              fontWeight: FontWeight.w400,
              color: const Color(0xFF262F38),
            ),
          ),
          AppGaps.hGap20,
          // Container(
          //   margin: EdgeInsets.only(top: 8.w, right: 8.w),
          //   width: 76.w,
          //   height: 36.w,
          //   decoration: BoxDecoration(
          //       borderRadius: BorderRadius.circular(4.w),
          //       color: Colors.white,
          //       border: Border.all(
          //         color: const Color(0xFFEFF2F6),
          //         width: 1,
          //       ),
          //       image: DecorationImage(
          //         image: NetworkImage(Interface.fileUrl + controller.profile.entity!.signatureUrl),
          //       )),
          // ).clickShowLarge(url: Interface.fileUrl + controller.profile.entity!.signatureUrl)
        ],
      ),
    );
  }
  ///true选中反之
  Widget _richTextNameCustom({
    bool two = false,
    bool three = false,
    bool four = false,
    bool five = false,
    bool six = false,
    bool seven = false,
  }) {
    return RichText(
      text: TextSpan(children: [
        TextSpan(
          text: '装置运行情况',
          style: TextStyle(
            fontSize: 13.sp,
            height: 2,
            fontWeight: FontWeight.w400,
            color: const Color(0xFF5C6DFF),
          ),
        ),
        WidgetSpan(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 8.w),
            child: SvgPicture.asset(
              two ? AppImages.icon_day_arrow_defalt : AppImages.icon_day_arrow,
            ),
          ),
        ),
        TextSpan(
          text: '人员到岗情况',
          style: TextStyle(
            fontSize: 13.sp,
            height: 2,
            fontWeight: FontWeight.w400,
            color: two ? const Color(0xFF5C6DFF) : const Color(0xFF262F38),
          ),
        ),
        WidgetSpan(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 8.w),
            child: SvgPicture.asset(
              // 替换为你的图片路径
              three ? AppImages.icon_day_arrow_defalt : AppImages.icon_day_arrow,
            ),
          ),
        ),
        TextSpan(
          text: '高危生产活动及作业的安全风险可控状态',
          style: TextStyle(
            fontSize: 13.sp,
            height: 2,
            fontWeight: FontWeight.w400,
            color: three ? const Color(0xFF5C6DFF) : const Color(0xFF262F38),
          ),
        ),
        WidgetSpan(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 8.w),
            child: SvgPicture.asset(
              four ? AppImages.icon_day_arrow_defalt : AppImages.icon_day_arrow,
            ),
          ),
        ),
        TextSpan(
          text: '生产装置的安全运行状态',
          style: TextStyle(
            fontSize: 13.sp,
            height: 2,
            fontWeight: FontWeight.w400,
            color: four ? const Color(0xFF5C6DFF) : const Color(0xFF262F38),
          ),
        ),
        WidgetSpan(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 8.w),
            child: SvgPicture.asset(
              five ? AppImages.icon_day_arrow_defalt : AppImages.icon_day_arrow,
            ),
          ),
        ),
        TextSpan(
          text: '罐区/仓库/重大危险源处于安全状态',
          style: TextStyle(
            fontSize: 13.sp,
            height: 2,
            fontWeight: FontWeight.w400,
            color: five ? const Color(0xFF5C6DFF) : const Color(0xFF262F38),
          ),
        ),
        WidgetSpan(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 8.w),
            child: SvgPicture.asset(
              six ? AppImages.icon_day_arrow_defalt : AppImages.icon_day_arrow,
            ),
          ),
        ),
        TextSpan(
          text: '安全风险报告',
          style: TextStyle(
            fontSize: 13.sp,
            height: 2,
            fontWeight: FontWeight.w400,
            color: six ? const Color(0xFF5C6DFF) : const Color(0xFF262F38),
          ),
        ),
        WidgetSpan(
          child: Padding(
            padding: EdgeInsets.symmetric(horizontal: 8.w),
            child: SvgPicture.asset(
              seven ? AppImages.icon_day_arrow_defalt : AppImages.icon_day_arrow,
            ),
          ),
        ),
        TextSpan(
          text: '安全承诺',
          style: TextStyle(
            fontSize: 13.sp,
            height: 2,
            fontWeight: FontWeight.w400,
            color: seven ? const Color(0xFF5C6DFF) : const Color(0xFF262F38),
          ),
        ),
      ]),
    );
  }

  Widget _titleName({required String title, Color color = const Color(0xFF444444)}) {
    return Row(
      children: [
        Expanded(
            child: Text(
          title,
          style: TextStyle(
            fontSize: 14.sp,
            height: 1.2,
            fontWeight: FontWeight.w500,
            color: color,
          ),
        )),
      ],
    );
  }

  /// 获取一行字段显示
  Widget _getTextView({required String title, required String value, Color? valueColor}) {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        AppGaps.hGap20,
        Text(
          title,
          style: TextStyle(
            fontSize: 14.sp,
            height: 1.2,
            fontWeight: FontWeight.w500,
            color: const Color(0xFF444444),
          ),
        ),
        Expanded(
            child: Text(
          value,
          style: TextStyle(
            fontSize: 14.sp,
            height: 1.2,
            fontWeight: FontWeight.w500,
            color: valueColor ?? const Color(0xff495061),
          ),
        ))
      ],
    );
  }

  /// 获取一行字段显示
  Widget _getTextViewEdit({required String title, required String unit, required String value}) {
    return Row(
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        AppGaps.hGap20,
        Text(
          title,
          style: TextStyle(
            fontSize: 14.sp,
            height: 1.2,
            fontWeight: FontWeight.w400,
            color: const Color(0xFF7C7D93),
          ),
        ),
        AppGaps.hGap8,
        _textField(value),
        AppGaps.hGap6,
        Text(
          unit,
          style: TextStyle(
            fontSize: 14.sp,
            height: 1.2,
            fontWeight: FontWeight.w400,
            color: const Color(0xFF495061),
          ),
        ),
      ],
    );
  }

  Widget _textField(String value) {
    return Container(
      width: 50.w,
      height: 28.w,
      margin: EdgeInsets.only(top: 6.w),
      alignment: Alignment.center,
      decoration: BoxDecoration(
        color: const Color(0xFFF7F9FC),
        border: Border.all(color: const Color(0xFFEBEDF0), width: 1.w),
        borderRadius: BorderRadius.all(
          Radius.circular(4.w),
        ),
      ),
      child: TextField(
          textAlign: TextAlign.center,
          keyboardType: TextInputType.number,
          textInputAction: TextInputAction.done,
          controller: TextEditingController(text: value),
          onChanged: (value) {},
          style: TextStyle(
            fontSize: 14.sp,
            height: 1.2,
            fontWeight: FontWeight.w400,
            color: const Color(0xff495061),
          ),
          decoration: InputDecoration(
            counterText: '',
            //防止适配不居中
            isCollapsed: true,
            border: const OutlineInputBorder(borderSide: BorderSide.none),
            contentPadding: EdgeInsets.only(left: 8.w),
            hintText: '',
            // hintStyle: TextStyle(fontSize: 14.sp, fontWeight: FontWeight.w400, color: const Color(0xffA0A7B5)),
          )),
    );
  }

  /// 2个复选框
  Widget _checkBox({
    String choice1Text = '选项1',
    String choice2Text = '选项2',
    bool initialChoice1 = false,
    bool initialChoice2 = false,
  }) {
    return Container(
      margin: EdgeInsets.only(left: 20.w),
      child: CustomTwoChoiceCheckbox(
        choice1Text: choice1Text,
        choice2Text: choice2Text,
        choice1TextColor: TextStyle(
          fontSize: 14.sp,
          fontWeight: FontWeight.w400,
          color: const Color(0xFF8D95A3),
        ),
        choice2TextColor: TextStyle(
          fontSize: 14.sp,
          fontWeight: FontWeight.w400,
          color: const Color(0xFF8D95A3),
        ),
        initialChoice1: initialChoice1,
        initialChoice2: initialChoice2,
        onChoice1Changed: (bool value) {
          AppToast.showSuccess('1$value');
        },
        onChoice2Changed: (bool value) {
          AppToast.showSuccess('2$value');
        },
        checkboxBuilder: (isSelected, onChanged) {
          return CustomCheckbox(
            isChecked: isSelected,
            onChanged: (bool? newValue) => onChanged(),
          );
        },
      ),
    );
  }

  /// 多个复选框
  Widget _multiChoiceCheckBox({
    String choice1Text = '选项1',
    String choice2Text = '选项2',
    String choice3Text = '选项3',
    bool initialChoice1 = false,
    bool initialChoice2 = false,
    bool initialChoice3 = false,
  }) {
    return Container(
      margin: EdgeInsets.only(left: 20.w),
      child: CustomMultiChoiceCheckbox(
        choicesText: [choice1Text, choice2Text, choice3Text],
        initialChoices: [initialChoice1, initialChoice2, initialChoice3],
        onChoiceChanged: (index, value) {
          AppToast.showSuccess('选项 $index 被选中$value');
        },
        checkboxBuilder: (isSelected, onChanged) {
          return CustomCheckbox(
            isChecked: isSelected,
            onChanged: (bool? newValue) => onChanged(),
          );
        },
      ),
    );
  }

  /// 标题背景分隔栏
  Widget _titleBg() {
    return Column(
      children: [
        AppGaps.vGap12,
        Container(
          height: 2.w,
          color: const Color(0xFF587DF5),
        ),
      ],
    );
  }

  ///顶部布局
  Widget _topWidget() {
    return Container(
      color: Colors.white,
      padding: EdgeInsets.only(left: 40.w, top: 20.w, right: 0.w, bottom: 20.w),
      child: Column(
        children: [
          Row(
            children: [
              _getFieldView('负责人：', 'XXX'),
              _getFieldView('部门：', 'XXX'),
            ],
          ),
          AppGaps.vGap14,
          Row(
            children: [
              _getFieldView('分厂：', 'XXX分厂'),
              _getFieldView('工段/车间：', 'XXX车间'),
            ],
          ),
          AppGaps.vGap14,
          Row(
            children: [
              _getFieldView('班组：', 'XXX班组'),
              _getFieldView('岗位：', 'XXX岗位'),
            ],
          ),
        ],
      ),
    );
  }

  /// 字段显示
  Widget _getFieldView(String title, String value, {double? width, Color? rightColor}) {
    return Expanded(
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          SizedBox(
            width: width ?? 68.w,
            child: Text(
              title,
              style: TextStyle(
                fontSize: 12.sp,
                height: 1.2,
                fontWeight: FontWeight.w400,
                color: const Color(0xFF444444),
              ),
            ),
          ),
          Expanded(
              child: Text(
            value,
            style: TextStyle(
              fontSize: 12.sp,
              height: 1.2,
              color: rightColor ?? const Color(0xFF7C7D93),
              fontWeight: FontWeight.w400,
            ),
          ))
        ],
      ),
    );
  }
}
